package com.lg.thread.day02.interruptTest;

/**
 * @author LG93
 * @create 2017-08-11 17:23
 **/
public class MyThread extends Thread {

    @Override
    public void run() {
        super.run();
        try {
            for (int i = 0; i < 500000; i++) {
                if (Thread.interrupted()) {
                    System.out.println("已经是停止状态了，退出线程");
                    throw new InterruptedException();
                }
                System.out.println("i="+(i+1));
            }
            System.out.println("我在for下边");
        } catch (InterruptedException e) {
            System.out.println("进入myThread类的catch方法了");
            e.printStackTrace();
        }
    }
}
